#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    getchar();

    int score[1001];
    for (int i = 0; i < n; i++)
        scanf("%d", &score[i]);
    int max = 0;
    int min = 10;
    for (int i = 0; i < n; i++)
    {
        if (score[i] > max)
            max = score[i];
        if (score[i] < min)
            min = score[i];
    }
    double end = 0;
    for (int i = 0; i < n; i++)
        end += score[i];
    end = (end - min - max) / (n - 2);
    printf("%.2f", end);
    return 0;
}